<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "work_account".
 *
 * @property integer $id
 * @property string $work_acc
 * @property string $work_pass
 * @property integer $ban
 * @property integer $work_type
 * @property integer $acc_pro_id
 *
 * @property AccProject $accPro
 */
class WorkAccount extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'work_account';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['work_acc', 'work_pass', 'acc_pro_id'], 'required'],
            [['work_pass'], 'string', 'max' => 32],
            [['ban', 'acc_pro_id'], 'integer'],
            [['work_acc'], 'string', 'max' => 25]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'work_acc' => 'Tên tài khoản',
            'work_pass' => 'Mật khẩu',
            'ban' => 'Bị khóa',
            'acc_pro_id' => 'Thành viên tham gia dự án',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getAccPro()
    {
        return $this->hasOne(AccProject::className(), ['id' => 'acc_pro_id']);
    }
}
